﻿using System;
using System.Collections.Generic;

namespace CXW.Core.Sharp.Sda
{
    /// <summary>
    /// This class contains properties you can use to control how SharpDevelop is launched.
    /// </summary>
    [Serializable]
    public sealed class StartupSettings
    {
        string applicationName = "CXW.Sharp";
        string applicationRootPath;
        string configDirectory;
        string dataDirectory;
        internal List<string> addInDirectories = new List<string>();

        /// <summary>
        /// Gets/Sets the application name used by the MessageService and some
        /// SharpDevelop windows. The default is "SharpDevelop".
        /// </summary>
        public string ApplicationName
        {
            get { return applicationName; }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");
                applicationName = value;
            }
        }

        /// <summary>
        /// Gets/Sets the application root path to use.
        /// Use null (default) to use the base directory of the SharpDevelop AppDomain.
        /// </summary>
        public string ApplicationRootPath
        {
            get { return applicationRootPath; }
            set { applicationRootPath = value; }
        }

        /// <summary>
        /// Gets/Sets the directory used to store SharpDevelop properties,
        /// settings and user AddIns.
        /// Use null (default) to use "ApplicationData\ApplicationName"
        /// </summary>
        public string ConfigDirectory
        {
            get { return configDirectory; }
            set { configDirectory = value; }
        }

        /// <summary>
        /// Sets the data directory used to load resources.
        /// Use null (default) to use the default path "ApplicationRootPath\data".
        /// </summary>
        public string DataDirectory
        {
            get { return dataDirectory; }
            set { dataDirectory = value; }
        }

        /// <summary>
        /// Find AddIns by searching all .addin files recursively in <paramref name="addInDir"/>.
        /// </summary>
        public void AddAddInsFromDirectory(string addInDir)
        {
            if (addInDir == null)
                throw new ArgumentNullException("addInDir");
            addInDirectories.Add(addInDir);
        }
    }
}